﻿using System;
using System.Collections.Generic;
using System.Text;
using TSVNAddin.TSVN;
using System.Windows.Forms;

namespace TSVNAddin.Core
{
	public class CreateRepositoryCommand : ICommand
	{
		private readonly TortoiseProcExecutor _TortoiseProcExecutor;
		private readonly FolderBrowserDialogAdapter _FolderBrowserDialog;

		public CreateRepositoryCommand(TortoiseProcExecutor tortoiseProcExecutor, FolderBrowserDialogAdapter folderBrowserDialog)
		{
			_TortoiseProcExecutor = tortoiseProcExecutor;
			_FolderBrowserDialog = folderBrowserDialog;
		}

		public void Execute()
		{
			var folder = _FolderBrowserDialog.ShowDialog();
			if (folder == string.Empty)
				return;

			_TortoiseProcExecutor.Exec(TortoiseProcCommandType.RepoCreate, folder);
		}

		public CommandStatus QueryStatus()
		{
			return CommandStatus.Enabled;
		}
	}
}
